package com.example.lenovo.tianqi.CityDB.domain;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by lenovo on 2018/1/11.
 */

public class Province implements Parcelable {
    public String provinceName;
    public int provinceSort;

    @Override
    public String toString() {
        return "[mProName] = " + provinceName + "\n" +
                "[mProSort] = " + provinceSort;
    }

    public Province(){}

    protected Province(Parcel in) {
        this.provinceName=in.readString();
        this.provinceSort=in.readInt();
    }

    public static final Creator<Province> CREATOR = new Creator<Province>() {
        @Override
        public Province createFromParcel(Parcel in) {
            return new Province(in);
        }

        @Override
        public Province[] newArray(int size) {
            return new Province[size];
        }
    };

//内容描述接口，基本不用
    @Override
    public int describeContents() {
        return 0;
    }

    //写入接口函数，打包.将你的对象序列化为一个Parcel对象，
    // 即：将类的数据写入外部提供的Parcel中，打包需要传递的
    //   数据到Parcel容器保存，以便从 Parcel容器获取数据
    @Override
    public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(this.provinceName);
    dest.writeInt(this.provinceSort);
    }
}
